Japan has been less severely hit by the coronavirus pandemic than many other advanced economies, but a recent surge in cases spurred it to close its borders to non-resident foreigners and declare a state of emergency in Tokyo and major cities.